import labels from "./label.js";
import desiccants from "./desiccant.js";
import humiditys from "./humidity.js";
import proLable from "./proLable.js";
import desiccantConfig from "../component/desiccantConfig.vue";
import humidityConfig from "../component/humidityConfig.vue";
import packageConfig from "../component/packageConfig.vue";
import labelConfig from "../component/labelConfig.vue";
import innerBoxConfig from "../component/innerBoxConfig.vue";
import proLableConfig from "../component/proLabelConfig.vue";
import reelConfig from "../component/reelConfig.vue";
import trayConfig from "../component/trayConfig.vue";
import app from "@/main.js";
import { Histogram, Tickets, Postcard, Picture } from "@element-plus/icons-vue";
import i18n from "@/locales/index.js";

const { t } = i18n.global;

export let MaterialList = {
  Labels: {
    key: "Labels",
    icon: Histogram,
    label: "产品标签",
    list: labels,
  },
  ProLabel: {
    key: "ProLable",
    icon: Tickets,
    label: "辅助标签",
    list: proLable,
  },
  Desiccant: {
    key: "Desiccant",
    icon: Picture,
    label: t("material.desiccant"),
    list: desiccants,
  },
  Humidity: {
    key: "Humidity",
    icon: Postcard,
    label: t("editFormula.humidity"),
    list: humiditys,
  },
};

let configList = {
  Desiccant: desiccantConfig,
  Humidity: humidityConfig,
  Package: packageConfig,
  Labels: labelConfig,
  InnerBox: innerBoxConfig,
  ProLable: proLableConfig,
  Reel: reelConfig,
  Tray: trayConfig,
};

export function componentInstall() {
  for (let key in configList) {
    if (!app.component(key)) {
      app.component(key, configList[key]);
    }
  }
}
